home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 5.2 KB | 185 lines | [TEXT/CWIE] |
- //========================================================================================
- //
- // File: View.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef VIEW_H
- #define VIEW_H
-
- #ifndef FWFRAME_H
- #include "FWFrame.h"
- #endif
-
- #ifndef FWSTRING_H
- #include "FWString.h"
- #endif
-
- #ifndef FWFONT_H
- #include "FWFont.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- #ifndef FWMAPING_H
- #include "FWMaping.h"
- #endif
-
- #ifndef FWTIME_H
- #include "FWTime.h"
- #endif
-
- //========================================================================================
- // Classes used by this interface
- //========================================================================================
-
- class FW_CTime;
- class FW_CGraphicContext;
- class CClockFrame;
-
- //========================================================================================
- // CClockView
- //========================================================================================
-
- class CClockView : public FW_CView
- {
- public:
- FW_DECLARE_AUTO(CClockView)
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Constructor/Destructor
- //
- public:
- CClockView(Environment* ev);
- virtual ~ CClockView();
-
- //----------------------------------------------------------------------------------------
- // Inherited API from FW_CView
- //
- public:
- virtual void PostCreateViewFromStream(Environment *ev);
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- public:
- void UpdateClock(Environment* ev, const FW_CTime& time);
-
- virtual ODShape* CreateUsedShape(Environment* ev, const FW_CRect& suggestedUsedRect) = 0;
-
- //----------------------------------------------------------------------------------------
- // Data Members
- //
- protected:
- CClockFrame* fClockFrame;
- FW_CTime fLastTime;
- };
-
- //========================================================================================
- // CAnalogView
- //========================================================================================
-
- class CAnalogView : public CClockView
- {
- public:
- FW_DECLARE_AUTO(CAnalogView)
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Constructor/Destructor
- //
- public:
- CAnalogView(Environment* ev);
- virtual ~ CAnalogView();
-
- //----------------------------------------------------------------------------------------
- // Inherited API from FW_CView
- //
- public:
- virtual void Draw(Environment* ev, ODFacet* odFacet, ODShape* invalidShape);
-
- //----------------------------------------------------------------------------------------
- // Inherited API from CClockView
- //
- public:
- virtual ODShape* CreateUsedShape(Environment* ev, const FW_CRect& suggestedUsedRect);
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- private:
- void DrawClockFace(Environment* ev, FW_CGraphicContext* gc);
- void DrawHourHand(Environment* ev, FW_CGraphicContext* gc, FW_Fixed hour, FW_Fixed minute);
- void DrawMinuteHand(Environment* ev, FW_CGraphicContext* gc, FW_Fixed minute);
- void DrawSecondHand(Environment* ev, FW_CGraphicContext* gc, FW_Fixed second);
-
- void DoUpdateClockFacet(Environment* ev,
- FW_CGraphicContext* gc,
- const FW_CRect& clockRect,
- const FW_CTime& newTime);
-
- public:
- static void* Create(FW_CReadableStream& stream, FW_ClassTypeConstant type);
- static void Destroy(void* object, FW_ClassTypeConstant type);
-
- };
-
- //========================================================================================
- // CDigitalView
- //========================================================================================
-
- class CDigitalView : public CClockView
- {
- public:
- FW_DECLARE_AUTO(CDigitalView)
- FW_DECLARE_CLASS
-
- //----------------------------------------------------------------------------------------
- // Constructor/Destructor
- //
- public:
- CDigitalView(Environment* ev);
- virtual ~ CDigitalView();
-
- //----------------------------------------------------------------------------------------
- // Inherited API from FW_CView
- //
- public:
- virtual void Draw(Environment* ev, ODFacet* odFacet, ODShape* invalidShape);
-
- //----------------------------------------------------------------------------------------
- // Inherited API from CClockView
- //
- public:
- virtual ODShape* CreateUsedShape(Environment* ev, const FW_CRect& suggestedUsedRect);
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- private:
- FW_CRect GetDigitalClockRect(Environment* ev, const FW_CRect& suggestedUsedRect);
-
- void DoUpdateClockFacet(Environment* ev,
- FW_CGraphicContext* gc,
- const FW_CRect& clockRect,
- const FW_CTime& newTime);
-
- public:
- static void* Create(FW_CReadableStream& stream, FW_ClassTypeConstant type);
- static void Destroy(void* object, FW_ClassTypeConstant type);
-
- //----------------------------------------------------------------------------------------
- // Data Members
- //
- private:
- FW_CFont fFont;
- };
-
- #endif
-